package com.powerunion.datacollection.common;


import com.powerunion.datacollection.common.SystemException;
import com.powerunion.util.log.LogHelper;
import org.apache.log4j.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class UserHelper {

    private Logger logger = LogHelper.getInstance().getLogger(UserHelper.class);
   
    /**
     * 判断当前用户是否管理员
     * @param request HttpServletRequest
     * @return boolean
     * @throws Exception
     */
    public boolean isSysManager(HttpServletRequest request)throws Exception{
        
        try{
        	
        	HttpSession session = request.getSession(false);

        	if (session != null && session.getAttribute("user") != null) {
                return true;
            } else{
            	return false;
            }

        }catch(Exception e){
            logger.error("",e);
            throw new SystemException("判断用户权限出现异常，请联系系统管理员！");
        }
    }


    

}
